nearly finished modularity optimiziation