Move the terminator variable to a private method, with a comment explaining its purpose