Breaking functions out to a testable module with some basic tests.