Reduce code duplication #44