Simplify code

Avoid calling `Number(value)` twice and clean up the code a bit.

Ref. http://www.wirfs-brock.com/allen/posts/128