General attributes/*.rb refactor

Mostly extractions to local variables.