Type checker

"Complete" type checker.