implemented profit calculation for tie
this isn't actually a change
fixed merge conflicts