rearrange code structure
add planning code