update examples
add middleware functionality
misc
remove unused middleware