diving functions in smaller parts