replaced jQuery selectors with cached variables to avoid flash