make documents optional

a bit tricky maybe but seems to work