refined for demo

add everything in main.cpp for demo