Fixed sql and moved populate queries to another file
restructured
Merge pull request #1 from mattcifelli/master

pull from master branch