reworking some code for sphere mapping