add comment
added error checking for system calls.  Not the most robust but better then nothing