Fixed a bug and a best practices around JS parseInt.