completely re working db