Refactor for duplication issues