refactored level class