Beginning to integrate functions to get algorithm working serially.