Added TODOs, tidied code