added nested printing, at the expense of terrible code