Added list reversal code