Changed syntax of cached attributes definition.
Removed code duplication.