Implemented scene.refresh, some minor refactorings