reorg and cleanup to get an understanding of how this module works