refactored initializing of level