Last changes I made before submitting to the compo
Bug fixes and cleaned up code