Breaking up the if-else if statements like this violates our style checks - move the comment inside the following block? Honestly there are a few too many comments for my liking in here - it hurts the readability of the code. Don't explain stuff that is obvious from the code, and consider breaking out code into well named methods as an alternative.