Revised code, functional but ugly crccheck.