Added valid check