Improving ruby script with DB and Users