refactor level manager