mostly adding junits and some small fixes