small clean up and some tests