moved stuff around, added tests.