refactor clause->proc