Added locking and constants