wrote two functions