middleware completely working