moved pyramid printing functionality into function