Big refactor, specially on db structure