implemented functions for part3