Added comments, TODOs, and test cases.