Many changes

I got rid of many of the errors but I am still having trouble
calculating the profit and it crashes on certain input.