Moved Chinese Remainder Theorem to function and added len function.