Changed name of the database connection from 'connection' to 'db' for consistency