Divide flush to main script and config. Also fixed connection and UTF8 problems