Testing under jruby and little cleanup of code

Testing under jruby and little cleanup of code