updated database, updated logic