Updated prin1 to handle lists and pairs