Added deadlock functionality