Improve DRY-ness, switch to class instead of module, fix some comments