Finished two functions