First draft of Miller's algorithm.