Create mutex locking

puts printf to be removed