refining codes