Modified some database related stuff