added method for reversing word