major refactor and DRY