added some comments to answer the the questions of Carlo, added method destroyState