Added JSHint settings and cleaned up code accordingly