Added type conversion and checking functions