This paper introduces a new algorithm for modularity-based community detection in large networks, called the Smart Local Moving (SLM) algorithm. The SLM algorithm improves upon existing methods by using a local moving heuristic in a more sophisticated way. It is shown to identify community structures with higher modularity values than the popular Louvain algorithm, especially for large-scale networks. The SLM algorithm is computationally efficient and performs well on both small and medium-sized networks. It is also able to detect community structures with modularity values comparable to or higher than those reported in the literature. The algorithm is based on an iterative approach that allows for multiple refinements of the community structure. The SLM algorithm is compared with the Louvain algorithm and its multilevel refinement variant on a variety of networks, including both small and large ones. The results show that the SLM algorithm consistently outperforms the Louvain algorithm in terms of modularity values, although it requires more computational time. The SLM algorithm is particularly effective for large networks, where it can detect community structures with higher modularity values than other algorithms. The algorithm is also able to detect community structures with higher modularity values than the CSA algorithm for small and medium-sized networks. The SLM algorithm is able to detect community structures with higher modularity values than the Louvain algorithm with multilevel refinement, although it requires more computational time. The SLM algorithm is able to detect community structures with higher modularity values than the Louvain algorithm with multilevel refinement, although it requires more computational time. The SLM algorithm is able to detect community structures with higher modularity values than the Louvain algorithm with multilevel refinement, although it requires more computational time.This paper introduces a new algorithm for modularity-based community detection in large networks, called the Smart Local Moving (SLM) algorithm. The SLM algorithm improves upon existing methods by using a local moving heuristic in a more sophisticated way. It is shown to identify community structures with higher modularity values than the popular Louvain algorithm, especially for large-scale networks. The SLM algorithm is computationally efficient and performs well on both small and medium-sized networks. It is also able to detect community structures with modularity values comparable to or higher than those reported in the literature. The algorithm is based on an iterative approach that allows for multiple refinements of the community structure. The SLM algorithm is compared with the Louvain algorithm and its multilevel refinement variant on a variety of networks, including both small and large ones. The results show that the SLM algorithm consistently outperforms the Louvain algorithm in terms of modularity values, although it requires more computational time. The SLM algorithm is particularly effective for large networks, where it can detect community structures with higher modularity values than other algorithms. The algorithm is also able to detect community structures with higher modularity values than the CSA algorithm for small and medium-sized networks. The SLM algorithm is able to detect community structures with higher modularity values than the Louvain algorithm with multilevel refinement, although it requires more computational time. The SLM algorithm is able to detect community structures with higher modularity values than the Louvain algorithm with multilevel refinement, although it requires more computational time. The SLM algorithm is able to detect community structures with higher modularity values than the Louvain algorithm with multilevel refinement, although it requires more computational time.