Middleware first implementation

The first implementation of middleware classes