simple (but kinda dirty) middleware for now