cleaning up; adding validation