refactor for less redundant validation in patch me