[DEV-2346] Reformat middleware code to fit Rover style guidelines.