added tests, clean up, fix #25, still need some work