changed logic to determine trusted source