updated device.rb model with three additional methods