Added source to the example this code was based on