Homework 6: Added validation