Fixed bug in IO, updated comments