setcode clean up