added my own jshints and tidied code