factor out methods