Updated to simplify the example and added more documentation.