Restructure codes for checking completion