a little bit restructuring

some work, some bugs