Support mod lock. split out key operations into separate module