added some commentaries and a main-definition