added third input variable