Added middleware api