added many unit tests; still got a lot of bugs