rename function and consolidate example code into a single file