Make twoOfOne function to clean up the if statement