get rid of convoluted code