GPU code reorganization and tweaks