Refactor skybox code