- changed the implementation for the semaphore;
- refactored some methods;