Revert "Revert "Pattern class update""

This reverts commit 88ee6242f3a9910cb18d6307c7955aa4f328d285.
Cleaned up some code

Tested the three main unlocking modes. They all work!