restucturing code into framework
fixed frameowkr implementation bug