Add docblocks and fix tests