fixed output formatting + program structure