Fixed order of if statement and fixed a few comments.