Added return flag for checkifValid, so page doesn't change if validation fails.
Fixed merge conflicts