Added reentrant lock