You don't really load the document here. Change this to `setDocument` instead?