successfully moved to library.rb and other files