updated conversion logic