Move origin parsing in to check_origin