bunch of additions and unit tests