reducing code complexity