Moved around the populate query functions