V1.8: used built-in errors, added wrapper functions for system calls in
test file, added comments for return values.