tidying up the locking