refine code based on code review feedback