Modular controller

A cleaner version of the previous modular controller pull-request.

Each commit will compile and test fine.