Almost ready to implement L+S algorithm.