add docs and refactor find_conf_levels, make more robust