Changed 'key' to 'keypath' + small fix to please jshint