Integrating example code into my code. Now just need to test.