Added sql row generation. Added smarter tab control