Moved types and collumn gathering to the database layer.