refactor into lib
refactor for better dir layout
adds .jshintrc