updated validation to clear before applying
modal functionality added