cleaned up EOF and debugging