NOTE I made the functions print the output instead of returning it, just to make the main function look cleaner.