changed profit calculation