Lots of minor fixes and adding of todo comments