finished case1 split, cleaned somewhat, added boundary types