Common code for Deadbolt 2