added initial middleware support