Fix console template and add tests
Merge branch 'database_support'