Reduce duplications and fix some docblocks