refactor codebase and add peer-group module