Now passes JSHint

- general code cleanups