implemented new functions in main