refine codes