Added timeouts to prevent infinite loops
Modified an error
Gathered all the IO stuff in an ioStruct type
Fixed conflicts
Deleted useless import