Tweaked more code, adding comments, removing whitespace