Please don't call same function again and again when the result is the same, you should cache the results.
Avoid dot lookups as much as possible.