bugfixes; added first DB functionality;