moving functions.
adding tests.