Re-submitted some changes that seemed to have gotten missed due to an IntelliJ crash, see #68.