Tidied code, removed some comments