Introduce build_bs_query, validate_user, validate_owned_wanted. ref #16