Revised the db layout. Might need more changes later.