Added regex validity check to removal too, formatting fixes