move all code into common module