Add locking feature to prevent stale code