Change $levels array to use class constants instead of numbers
Add exception and variable type docs