small modifications and unit test improvements