started adding functions
first half of tests pass.