Locking is now completely realm-based. Still needs tweaking, but it
seems to do part of what it's meant to.