Combined two code examples.