factored out shared definitions