Working database scheme and remove some old code