Added database and validation checks