Move Query Time Functions to the Same File