implement all functionality
added validation of input number