Added an unfold function