Tidied up / improved readability / added underscore.js