renamed variables and passing entity as parameters