Refactor the pretty printer to reduce complexity

And also reduce complexity of Element#inspect