Fix problems with db, add form checks, logger