Support non-persisitent semaphores

General refactor to add cleanliness, support for temporary
seamphores and improve documentation