changed implementation, now uses JSHint