swap model to algorithm