First draft of all algorithms.