merged refactor branch into main