code tidied up, TODOs