confusing code cleanup
add caching var for $ call
Merge pull request #2247 from shikolay/master

Micro cleanups