Simplified Typecheck.scala and added tests for it.