cut unneccessary repeat code out