Added string reversal and fixed bugs