Added difficulty parameter to the authorizeFn