Code cleanup in controller, style cleanup, unified diff (Fixes #5)