refactored level module