-added SQL support
-refactoring