Refactoring for separating js code and var / function names