once we add error propagation the common code will become even larger, so it makes sense to move it out.