Added template fallback and database class