refactor and add tests
add jshintrc