Cleaned everything to a decent state, prepared to refactor