rewrite make it modular solution.