Refactored to new SGNaiveQL and also commited a bunch of test program