Commit Three

Got some cool query functions working.
Lots still to do though.