Updated to work in 2014 with Ruby2.1.3