update basic architecture of the code
continue restructuring the code.