function prob 1 finished