Added use of lock