Various changes; split base functions out of Setup.rb