Adding EOF exception handling