Docblocks fixes
Deduplicate code
Code tweaks