refactored documents.rb and spreaded the different class in different files