FYI `res` is not defined. Easy fix but this suggests you wrote this code without testing or even running it. You should be less careless.