Midstate in code changes for C and V detection