Improve validation and jruby support