+1 for factoring out the duplicated code