Hammering together a middleware idea