Adding type checking code for comp functions