moving code around to write tests.