Cleaning up the code

This resolves issue #1