Added initial implementation of algorithm.