slight re-factoring and took care of some TODOs