Rewrite tests
Small changes to conform with jshint