main functionnality implemented