Added error handling for wrong conversions