Final cleanup and fix #4.