Added code for regression alongwith some other changes. wip.