Minor refactorings

Various refactorings suggested by IntelliJ. Still getting used to github before I start making some useful changes.  I will probably have a few more pulls like this.