stage 3 - working on deadlock prevention