TODOs resolved: unit tests added.