Updated the post with a code snippet.