TODOs, comments, typos, path handling, some refactoring. 2nd round.