Typechecker added for the library
Added a typechecker that is purged when running in optimized mode (-O option).