Moved scalars into argument list so they can be set externally.