Modal middleware plugin

Implements the initial modal middleware plugin based on the current modal. Closes #59.