prolog algo, bindings, error-proofing