Misc bug fixes. Created non-functional gui for TMS queries