Restructures example code.
Adds comments for implementations