finished two functions