cleanup, and test improvement