adapted for new database structure - closes #10