#1278 Reduce code duplication