Refactored thr layout
Wrote Rspec Tests