fix order in base.rb
refactor again, not tested