Finished implementation of CRT, and finished main method.