refine codebase