changed the two functions