fixed a bug
started adding unit tests