Refine middleware models and authentication add ons.