Corrected many, many error. Also implemented new random algorithm. Thanks @Kuhar