Added check for io and some formatting