It's not often that I get the opportunity to refactor javascript code... can you give me more information by what you mean by only using one var declaration?