mark: pulling out a function