Preformatting temp data for smoother MySQL queries