Completed the first draft of the entire algorithm through graphlab.