Remove unnecessary lines, improve some comments, relocate minor things into private methods.