Fix code complexity violations