Moved preparation of with() parameters to a separate method