extract out some code that we may need later