added test case #8
big commit of remaining changes