Begin refactoring of c2s and sm into their own modules

Signed-off-by: Daniele Ricci <daniele.athome@gmail.com>