better partitioning of main module