added two seperate modules for mysql and postgres
cleaned up the code