not yet done test fix and code clean

just started,
todo: finish