Flexible Planning by Integrating Multilevel Reasoning