Adding function and tests related to validation