added code from class examples