Added opEquals support. Improved casting and the defintion of the type checking templates.