improved performance, added pagination, and rspec testing