writing unit tests, fixing bugs