Factored out duplicated methods.