Code Cleanup

Fixes #327