fixing some jshint concerns: singlequotes!
calculate width and height more intelligently