+1 on refactoring of common code