finished product; debugged main.rb and a few other spots