too much responsibility in JS file