Added a more complex choice test case and fixes various issues.