slimming down the code