Have semaphores working moderately well. Getting a segfault, though