Minor code shuffling/simplification, unused variable cleanups, comment fixing.