Income taxes - Reconciliation of Beginning and Ending Amount of Unrecognized Tax Benefits (Details) - USD ($)
$ in Thousands
12 Months Ended
Dec. 31, 2016
Dec. 31, 2015
Dec. 31, 2014
Reconciliation of unrecognized tax benefits      
Beginning balance $ 14,943 $ 8,356 $ 9,033
Additions based on tax positions related to prior years 3,140 6,448 0
Additions based on tax positions related to current year 256 261 0
Reductions based on lapse of statute of limitations (102) (122) (215)
Reductions based on tax positions related to prior years 0 0 (462)
Ending balance $ 18,237 $ 14,943 $ 8,356