Additional unit tests added, some small fixes