Added semaphore because it turns out module code is preemtible. Significant code clean up. Release candidate for demo