implementing middleware