<?xml version="1.0" encoding="us-ascii"?><InstanceReport xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"><Version>2.2.0.25</Version><hasSegments>false</hasSegments><hasScenarios>false</hasScenarios><ReportLongName>0206 - Disclosure - Stockholders' equity and treasury stock</ReportLongName><DisplayLabelColumn>true</DisplayLabelColumn><ShowElementNames>false</ShowElementNames><RoundingOption /><HasEmbeddedReports>false</HasEmbeddedReports><Columns><Column><Id>1</Id><IsAbstractGroupTitle>false</IsAbstractGroupTitle><LabelColumn>false</LabelColumn><CurrencyCode>USD</CurrencyCode><FootnoteIndexer /><hasSegments>false</hasSegments><hasScenarios>false</hasScenarios><MCU><KeyName>1/1/2010 - 12/31/2010
USD ($)

USD ($) / shares

</KeyName><CurrencySymbol>$</CurrencySymbol><contextRef><ContextID>Jan-01-2010_Dec-31-2010</ContextID><EntitySchema>http://www.sec.gov/CIK</EntitySchema><EntityValue>0001358071</EntityValue><PeriodDisplayName /><PeriodType>duration</PeriodType><PeriodStartDate>2010-01-01T00:00:00</PeriodStartDate><PeriodEndDate>2010-12-31T00:00:00</PeriodEndDate><Segments /><Scenarios /></contextRef><UPS><UnitProperty><UnitID>USD</UnitID><UnitType>Standard</UnitType><StandardMeasure><MeasureSchema>http://www.xbrl.org/2003/iso4217</MeasureSchema><MeasureValue>USD</MeasureValue><MeasureNamespace>iso4217</MeasureNamespace></StandardMeasure><Scale>0</Scale></UnitProperty><UnitProperty><UnitID>USDEPS</UnitID><UnitType>Divide</UnitType><NumeratorMeasure><MeasureSchema>http://www.xbrl.org/2003/iso4217</MeasureSchema><MeasureValue>USD</MeasureValue><MeasureNamespace>iso4217</MeasureNamespace></NumeratorMeasure><DenominatorMeasure><MeasureSchema>http://www.xbrl.org/2003/instance</MeasureSchema><MeasureValue>shares</MeasureValue><MeasureNamespace>xbrli</MeasureNamespace></DenominatorMeasure><Scale>0</Scale></UnitProperty><UnitProperty><UnitID>Shares</UnitID><UnitType>Standard</UnitType><StandardMeasure><MeasureSchema>http://www.xbrl.org/2003/instance</MeasureSchema><MeasureValue>shares</MeasureValue><MeasureNamespace>xbrli</MeasureNamespace></StandardMeasure><Scale>0</Scale></UnitProperty></UPS><CurrencyCode>USD</CurrencyCode><OriginalCurrencyCode>USD</OriginalCurrencyCode></MCU><CurrencySymbol>$</CurrencySymbol><Labels><Label Id="1" Label="12 Months Ended" /><Label Id="2" Label="Dec. 31, 2010" /></Labels></Column></Columns><Rows><Row><Id>2</Id><IsAbstractGroupTitle>true</IsAbstractGroupTitle><Level>0</Level><ElementName>us-gaap_StockholdersEquityNoteAbstract</ElementName><ElementPrefix>us-gaap</ElementPrefix><IsBaseElement>true</IsBaseElement><BalanceType>na</BalanceType><PeriodType>duration</PeriodType><ShortDefinition>No definition available.</ShortDefinition><IsReportTitle>false</IsReportTitle><IsSegmentTitle>false</IsSegmentTitle><IsSubReportEnd>false</IsSubReportEnd><IsCalendarTitle>false</IsCalendarTitle><IsTuple>false</IsTuple><IsEquityPrevioslyReportedAsRow>false</IsEquityPrevioslyReportedAsRow><IsEquityAdjustmentRow>false</IsEquityAdjustmentRow><IsBeginningBalance>false</IsBeginningBalance><IsEndingBalance>false</IsEndingBalance><IsReverseSign>false</IsReverseSign><PreferredLabelRole /><FootnoteIndexer /><Cells><Cell><Id>1</Id><IsNumeric>false</IsNumeric><IsRatio>false</IsRatio><DisplayZeroAsNone>false</DisplayZeroAsNone><NumericAmount>0</NumericAmount><RoundedNumericAmount>0</RoundedNumericAmount><NonNumbericText /><NonNumericTextHeader /><FootnoteIndexer /><CurrencyCode /><CurrencySymbol /><IsIndependantCurrency>false</IsIndependantCurrency><ShowCurrencySymbol>false</ShowCurrencySymbol><DisplayDateInUSFormat>false</DisplayDateInUSFormat><hasSegments>false</hasSegments><hasScenarios>false</hasScenarios></Cell></Cells><OriginalInstanceReportColumns /><Unit>Other</Unit><ElementDataType>xbrli:stringItemType</ElementDataType><SimpleDataType>string</SimpleDataType><ElementDefenition>No definition available.</ElementDefenition><IsTotalLabel>false</IsTotalLabel><IsEPS>false</IsEPS><Label>Stockholders' equity and treasury stock[Abstract]</Label></Row><Row><Id>3</Id><IsAbstractGroupTitle>false</IsAbstractGroupTitle><Level>0</Level><ElementName>us-gaap_StockholdersEquityNoteDisclosureTextBlock</ElementName><ElementPrefix>us-gaap</ElementPrefix><IsBaseElement>true</IsBaseElement><BalanceType>na</BalanceType><PeriodType>duration</PeriodType><ShortDefinition>No definition available.</ShortDefinition><IsReportTitle>false</IsReportTitle><IsSegmentTitle>false</IsSegmentTitle><IsSubReportEnd>false</IsSubReportEnd><IsCalendarTitle>false</IsCalendarTitle><IsTuple>false</IsTuple><IsEquityPrevioslyReportedAsRow>false</IsEquityPrevioslyReportedAsRow><IsEquityAdjustmentRow>false</IsEquityAdjustmentRow><IsBeginningBalance>false</IsBeginningBalance><IsEndingBalance>false</IsEndingBalance><IsReverseSign>false</IsReverseSign><PreferredLabelRole>terselabel</PreferredLabelRole><FootnoteIndexer /><Cells><Cell><Id>1</Id><IsNumeric>false</IsNumeric><IsRatio>false</IsRatio><DisplayZeroAsNone>false</DisplayZeroAsNone><NumericAmount>0</NumericAmount><RoundedNumericAmount>0</RoundedNumericAmount><NonNumbericText>&lt;!--DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd" --&gt;
   &lt;!-- Begin Block Tagged Note 6 - us-gaap:StockholdersEquityNoteDisclosureTextBlock--&gt;
   &lt;div style="margin-left: 0%"&gt;
   &lt;div style="margin-top: 12pt; font-size: 1pt"&gt;&amp;#160;
   &lt;/div&gt;
   &lt;table width="100%" border="0" cellpadding="0" cellspacing="0" style="font-size: 10pt; font-family: Arial, Helvetica; color: #000000; background: transparent; text-align: left"&gt;
   &lt;tr&gt;
       &lt;td width="8%"&gt;&lt;/td&gt;
       &lt;td width="92%"&gt;&lt;/td&gt;
   &lt;/tr&gt;
   &lt;tr valign="top"&gt;
       &lt;td&gt;
       &lt;b&gt;&lt;font style="font-family: 'Times New Roman', Times"&gt;Note&amp;#160;F.&amp;#160;&amp;#160;&lt;/font&gt;&lt;/b&gt;
   &lt;/td&gt;
       &lt;td&gt;
       &lt;b&gt;&lt;i&gt;&lt;font style="font-family: 'Times New Roman', Times"&gt;Stockholders&amp;#8217;
       equity and treasury stock&lt;/font&gt;&lt;/i&gt;&lt;/b&gt;
   &lt;/td&gt;
   &lt;/tr&gt;
   &lt;/table&gt;
   &lt;div style="margin-top: 6pt; font-size: 1pt"&gt;&amp;#160;
   &lt;/div&gt;
   &lt;div align="left" style="margin-left: 0%; margin-right: 0%; text-indent: 4%; font-size: 10pt; font-family: 'Times New Roman', Times; color: #000000; background: transparent"&gt;
       &lt;b&gt;&lt;i&gt;Public common stock offering.&lt;/i&gt;&lt;/b&gt;&amp;#160;&amp;#160;In
       December 2010, the Company issued, including the over-allotment
       option, in a secondary public offering 2.9&amp;#160;million shares
       of our common stock at $82.50 per share and we received net
       proceeds of approximately $227.4&amp;#160;million. The Company used
       the net proceeds from this offering to repay a portion of the
       borrowings under our credit facility.
   &lt;/div&gt;
   &lt;div style="margin-top: 6pt; font-size: 1pt"&gt;&amp;#160;
   &lt;/div&gt;
   &lt;div align="left" style="margin-left: 0%; margin-right: 0%; text-indent: 4%; font-size: 10pt; font-family: 'Times New Roman', Times; color: #000000; background: transparent"&gt;
       In February 2010, the Company issued, including the
       over-allotment option, in a secondary public offering
       5.3&amp;#160;million shares of our common stock at $42.75 per share
       and we received net proceeds of approximately
       $219.3&amp;#160;million. The Company used the net proceeds from this
       offering to repay a portion of the borrowings under our credit
       facility.
   &lt;/div&gt;
   &lt;div style="margin-top: 6pt; font-size: 1pt"&gt;&amp;#160;
   &lt;/div&gt;
   &lt;div align="left" style="margin-left: 0%; margin-right: 0%; text-indent: 4%; font-size: 10pt; font-family: 'Times New Roman', Times; color: #000000; background: transparent"&gt;
       &lt;b&gt;&lt;i&gt;Private placement of common stock.&lt;/i&gt;&lt;/b&gt;&amp;#160;&amp;#160;In
       October 2010, the Company closed the private placement of its
       common stock, simultaneously with the closing of the Marbob
       Acquisition, on 6.6&amp;#160;million shares of our common stock at a
       price of $45.30 per share for net proceeds of approximately
       $292.7&amp;#160;million.
   &lt;/div&gt;
   &lt;!-- XBRL Pagebreak Begin --&gt;
   &lt;/div&gt;
   &lt;!-- END PAGE WIDTH --&gt;
   &lt;!-- PAGEBREAK --&gt;
   &lt;div style="margin-left: 0%"&gt;
   &lt;!-- BEGIN PAGE WIDTH --&gt;
   &lt;div align="center" style="margin-left: 0%; margin-right: 0%; font-size: 10pt; font-family: Arial, Helvetica; color: #000000; background: transparent"&gt;
   &lt;b&gt;
   &lt;font style="font-family: 'Times New Roman', Times"&gt;
   &lt;/font&gt;
   &lt;/b&gt;
   &lt;/div&gt;
   &lt;div style="margin-top: 0pt; font-size: 1pt"&gt;
   &lt;/div&gt;
   &lt;div align="center" style="margin-left: 0%; margin-right: 0%; font-size: 10pt; font-family: Arial, Helvetica; color: #000000; background: transparent"&gt;
   &lt;b&gt;
   &lt;font style="font-family: 'Times New Roman', Times"&gt;
   &lt;/font&gt;
   &lt;/b&gt;
   &lt;/div&gt;
   &lt;!-- XBRL Pagebreak End --&gt;
   &lt;div style="margin-top: 6pt; font-size: 1pt"&gt;&amp;#160;
   &lt;/div&gt;
   &lt;div align="left" style="margin-left: 0%; margin-right: 0%; text-indent: 4%; font-size: 10pt; font-family: 'Times New Roman', Times; color: #000000; background: transparent"&gt;
       In July 2008, we closed the private placement of our common
       stock, simultaneously with the closing of the Henry Entities
       acquisition, on 8.3&amp;#160;million shares of our common stock at a
       price of $30.11 per share for net proceeds of approximately
       $242.4&amp;#160;million.
   &lt;/div&gt;
   &lt;div style="margin-top: 6pt; font-size: 1pt"&gt;&amp;#160;
   &lt;/div&gt;
   &lt;div align="left" style="margin-left: 0%; margin-right: 0%; text-indent: 4%; font-size: 10pt; font-family: 'Times New Roman', Times; color: #000000; background: transparent"&gt;
       &lt;b&gt;&lt;i&gt;Treasury stock.&lt;/i&gt;&lt;/b&gt;&amp;#160;&amp;#160;The restrictions on
       certain restricted stock awards issued to certain of the
       Company&amp;#8217;s officers lapsed during the years ended
       December&amp;#160;31, 2010, 2009, and 2008. Immediately upon the
       lapse of restrictions, these officers and key employees became
       liable for income taxes on the value of such shares. In
       accordance with the Company&amp;#8217;s 2006 Stock Incentive Plan and
       the applicable restricted stock award agreements, some of such
       officers and key employees elected to deliver shares of the
       Company&amp;#8217;s common stock to the Company in exchange for cash
       used to satisfy such tax liability. In total, at
       December&amp;#160;31, 2010 and 2009, the Company had acquired 31,963
       and 12,380&amp;#160;shares of the Company&amp;#8217;s common stock,
       respectively, that are held as treasury stock in the approximate
       amount of $1.6&amp;#160;million and $0.4&amp;#160;million, respectively.
   &lt;/div&gt;
   &lt;/div&gt;
</NonNumbericText><NonNumericTextHeader>&lt;!--DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd" --&gt;
   &lt;!-- Begin Block Tagged Note</NonNumericTextHeader><FootnoteIndexer /><CurrencyCode /><CurrencySymbol /><IsIndependantCurrency>false</IsIndependantCurrency><ShowCurrencySymbol>false</ShowCurrencySymbol><DisplayDateInUSFormat>false</DisplayDateInUSFormat><hasSegments>false</hasSegments><hasScenarios>false</hasScenarios></Cell></Cells><OriginalInstanceReportColumns /><Unit>Other</Unit><ElementDataType>us-types:textBlockItemType</ElementDataType><SimpleDataType>string</SimpleDataType><ElementDefenition>Disclosures related to accounts comprising shareholders' equity, including other comprehensive income.  Includes: (1) balances of common stock, preferred stock, additional paid-in capital, other capital and retained earnings; (2) accumulated balance for each classification of other comprehensive income and total amount of comprehensive income; (3) amount and nature of changes in separate accounts, including the number of shares authorized and outstanding, number of shares issued upon exercise and conversion, and for other comprehensive income, the adjustments for reclassifications to net income; (4) rights and privileges of each class of stock authorized; (5) basis of treasury stock, if other than cost, and amounts paid and accounting treatment for treasury stock purchased significantly in excess of market; (6) dividends paid or payable per share and in the aggregate for each class of stock for each period presented; (7) dividend restrictions and accumulated preferred dividends in arrears (in aggregate and per share amount); (8) retained earnings appropriations or restrictions, such as dividend restrictions; (9) impact of change in accounting principle, initial adoption of new accounting principle and correction of an error in previously issued financial statements; (10) shares held in trust for Employee Stock Ownership Plan (ESOP); (11) deferred compensation related to issuance of capital stock; (12) note received for issuance of stock; (13) unamortized discount on shares; (14) description, terms and number of warrants or rights outstanding; (15) shares under subscription and subscription receivables; effective date of new retained earnings after quasi-reorganization and deficit eliminated by quasi-reorganization and, for a period of at least ten years after the effective date, the point in time from which the new retained dates; and (16) retroactive effective of subsequent change in capital structure.</ElementDefenition><ElementReferences>Reference 1: http://www.xbrl.org/2003/role/presentationRef
 -Publisher FASB
 -Name Statement of Financial Accounting Standard (FAS)
 -Number 5
 -Paragraph 15

Reference 2: http://www.xbrl.org/2003/role/presentationRef
 -Publisher SEC
 -Name Regulation S-X (SX)
 -Number 210
 -Section 04
 -Article 3

Reference 3: http://www.xbrl.org/2003/role/presentationRef
 -Publisher SEC
 -Name Regulation S-X (SX)
 -Number 210
 -Section 08
 -Paragraph d
 -Article 4

Reference 4: http://www.xbrl.org/2003/role/presentationRef
 -Publisher SEC
 -Name Staff Accounting Bulletin (SAB)
 -Number Topic 4
 -Section C, E

Reference 5: http://www.xbrl.org/2003/role/presentationRef
 -Publisher AICPA
 -Name Accounting Principles Board Opinion (APB)
 -Number 12
 -Paragraph 10

Reference 6: http://www.xbrl.org/2003/role/presentationRef
 -Publisher SEC
 -Name Regulation S-X (SX)
 -Number 210
 -Section 02
 -Paragraph 29, 30, 31
 -Article 5

Reference 7: http://www.xbrl.org/2003/role/presentationRef
 -Publisher AICPA
 -Name Accounting Research Bulletin (ARB)
 -Number 43
 -Chapter 1
 -Section B
 -Paragraph 7, 11A

Reference 8: http://www.xbrl.org/2003/role/presentationRef
 -Publisher FASB
 -Name Statement of Financial Accounting Standard (FAS)
 -Number 129
 -Paragraph 2, 3, 4, 5, 6, 7, 8

Reference 9: http://www.xbrl.org/2003/role/presentationRef
 -Publisher SEC
 -Name Regulation S-X (SX)
 -Number 210
 -Section 08
 -Article 4

</ElementReferences><IsTotalLabel>false</IsTotalLabel><IsEPS>false</IsEPS><Label>Stockholders' equity and treasury stock</Label></Row></Rows><Footnotes /><NumberOfCols>1</NumberOfCols><NumberOfRows>2</NumberOfRows><ReportName>Stockholders' equity and treasury stock</ReportName><MonetaryRoundingLevel>UnKnown</MonetaryRoundingLevel><SharesRoundingLevel>UnKnown</SharesRoundingLevel><PerShareRoundingLevel>UnKnown</PerShareRoundingLevel><ExchangeRateRoundingLevel>UnKnown</ExchangeRateRoundingLevel><HasCustomUnits>false</HasCustomUnits><SharesShouldBeRounded>true</SharesShouldBeRounded></InstanceReport>
