Various changes

My main goal for this pull-request is to make enumeration restrictions use the constants instead of hard-coded string values. 

Along with that, this should include various changes (docblocks, formatting, etc.). Feel free to cherry-pick as needed.