Factored out common code from synapse fitters