modified to allow for dependency injection of enginevars