Added read/write to loop, updated TODO comments.