minor code changes, mainly jshints but also removing unnecessary variables