add validation and print function