Wrote two functions