Rearranged files, added query stuff