Added reversal function