change getMargin to be const, and uncommented checkMargin code