Added caching, fixed issues due to DOM changes