move js-logic from helper to separate file