added recursive print method