major refactoring. tested on fetching, printing, contact and logout