more comples code generation works! in the process, I accidently handled some of the semantics as well