Handling success case and fail case