refactor(main): code optimisation