a bit of code cleanup and some todo's