implementing locks