Add semaphores and comments at top of source codes