24 hour shift bug, speeding up queries