documentHandler code