Reduce complexity of attributes_hash method