General refactoring and improvements. Remove unused imports, fix up some
style issues, removed unused code. References #4.