Working version with DB improvements.