20141126 this is the first draft of the whole program