improved prepare_local and docs