Config singleton, template fix, new sql