added code and notes