changed all '\n's to endl's because they weren't printing properly when the segfault came