Modified unlock function. Updated main and RestAPI to account for new function argument.