improved database structure
tally bug fix