Re-arranged dev and production middleware