implement rudimentary middleware approach