Re-layout
Fix variable name $WAIT to $DELAY
Remove unused codes