Easy optimizations

Some easy optimizations discovered by a local FindBugs run.