added profit calculation