tidyin' duplicate code