Cleaned up code
See #165