Fixed more semantics with generated ICode in references to functions and references to objects. Updated some test cases.