Updated code-gen in semantic check branch