Several TODOs resolved: documentation added.