Updating margin formula