Updated code to support jruby