Avoid shadowing varaiables ruby 1.8 specifies that it should override variable in outer scope which differs from ruby 1.9
Whitespace
Improve mechanisms of caching defined methods so that it works across ruby implementations