Improvements in semantic analyzis. Also some input test cases.