Added changes from commit SHA: 645a0db3713e56f656f553a9d55af19f184e0885
Added changes from commit SHA: ce46b3b8198f77ddf170413fc58f89f83b179c24
Wrote frontend tests, fixed some small bugs.
Reorganized directory structure. Also got rid of sgdbackend_query layer.
Added tests for nex backend.