Mosul has remained an active area for insurgents , even as security in other parts of the country has improved and violence has diminished .