Rewrite clear and reverse functions in better way
Rewrite clear and reverse functions in better way