added error message for nonexistent file, added plot of margin