Refactored the level manager implementation