added eslint, tests, refactor