use macro replace constant
use UBOUND macro replace array length constant
update stream output
add terminal module interface