Added Locks to solve concourrency problems!