Refactoring XMLKey to fix concurrency issues when using JRuby. Moving all lambdas defined in constants into class methods.