added third and fourth variables