Added locks for all operations