changed mutexes to spinlocks