converting element value and element type conversion switch statements into functions...