Work in progress: Adapted lottery algorithm to work with model objects