several changes to the structure and added code samples