Implemented JSHint and fixed js warnings