adde line breaking after 80 dots
refactored output and removed code duplication