first gui version
add a thread which keep watching a flag file
refacted and opts dealing added