lowercase function.
cut redundant loop.
made function 'waitSignal'.