Basic classes and algorithms.