Wrote more code for function type checking. Also fixed how a type error was being generated (was mixing error message on stderr and stdout).