moved eof check deeper
fixed row by row traversal to really go row by row and not column by column