db classes introduced and split to files

+some refactor done