Perfect JS code structure for old large codebase