Refactored drivers and algorithms

See #412 for detail.