Infinity is actually a JavaScript constant, so no need for hacky math

Sorry, I wasn't able to read the code without cringing a bit :P