It might also be nice to fix these while you're making changes to this function.  `y.dtype` is enough here and below.