Add filters and attributes tables to postgres; docs, refactoring