Better way of constructing attributes hashes