Many bugfixes and completing db support in several classes