changed buffer sizes
swapped semaphore for mutex