first function done

completed and commented on first function