pruning duplicate code