cleaned up the level view code