10/2/2014 night 

modular programming modification.

semaphore and semaphore array added.