Emil some changes and additions, now passes test3