adding new function handling locking