Clean-up

Cleaned-up ugly parts of the code