Big refactoring due to restructurisation of db.

Alphabet and building are now part of "chain" table.