Updating code documentation in-line, fixed some TODOs