refactored leap.rb