code for comparison and conversion