added code to main function in order to exemplify the logic beetween classes