implemented update and added example in main