Removing duplication of logic.