Optimized some planning logic by adjusting the structure of nested big amount of " if else" .