Added regression function and sorted it out.
Added comments for the maximisation problem.