Tested an implementation to fix jshint issue