add Thor database access code