Use npm
jshint
bower
Don't rely on window being defined
Fix tests
Fix some if statements