Cleaned up JS to clear JSHint warnings