Collapse track and middleware

Now that its one class can simplify the implementation.