implement flow management
add output module for integration
remove comment out code and replace magic variables