Added rawCharacteristic, isFinitePrimeField, fixed some static casts

Also removed some dead code