Split the modularity patch into smaller pieces. Add the mode module

Change-Id: I8bbfc9e9d1e056a9f039e1ff210d2e61c48a7bf5
Signed-off-by: Maxime Millette-Coulombe <mmcoulombe@inocybe.com>