A refactoring approach for optimizing mobile networks