Updating code example in docs for 3.1 compatibility