finished main functionality. see todo's