Refactor: separating input from context in planning

- using an unique context when planning
- sub query lookup table is not in the context anymore