Update DB scheme

and refactor the classes to match the updated scheme.