Add unit test (work in progress), minor code changes