I think this is duplicate code. See lines 215-216. I suggest adding the the res type there though.