resolved merge conflicts
broken... middleware, needs work