document setup function