abstract most of the completion code