It shouldn't have ended like this
The way it should have ended:
-Costigan arrests Sullivan and takes him to police station
-Dignam returns from absence
-Dignam & Costigan proves Sullivan is the rat
-Sullivan gets life sentence without parole
-Costigan is accepted to Massachusetts State Police as a Staff Sergeant and given medal of honour
-Dignam gets promoted
-Barrigan's cover is not blown. He continues being a cop, but quits being a mole
-Costigan & Madolyn gets married, Madolyn gives birth to Costigan's baby
-Gwen inherits Costello's assets, moves to Los Angeles and lives a rich life