unit tests + small bug fix, lots of examples in unit tests