Further simplify the codes; Test random inputs to check the quality;