code cleanup, bug fixes, and upgradable==>safe for safe mode that prevents a lock from upgrading unless it is the only one that has acquired the lock.