Build classes and reimplemented some algorithms.