lots of cleanup, added tests and the ability to get accounts