reorganise code layout
Merge remote-tracking branch 'origin/input_handling' into input_handling

* origin/input_handling:
  reorganise code layout