Added comments and rearranged definitions
added examples