Improve db

@6 could you please take a look at this