Adding in source code for examples 1-7