cleaner solution to js doubler