update test scripts and middleware structure'