extract Message class, simplify top level module