trying to cut down on duplicated code
trying to name all vars at top of file
now jsLint valid