Code refinment