main functions & some more documentation