Moved canvas dimension code into utils.js file for future reference.