Fix code complexity