Added attr methods and wrote rspec tests