Corrected a warning (type conversion) and formatted the code