some cleanup
rewrite unittest