clean up and adds tests