We establish general sufficient conditions for maps between function algebras to be composition or weighted composition operators, which extend previous results in [2, 4, 6, 7]. Let X be a locally compact Hausdorff space and A subset of C(X) a dense subalgebra of a function algebra, not necessarily with unit, such that X = DA and p(A) = delta A, where partial derivative A is the Shilov boundary, partial derivative A the Choquet boundary, and p(A) the set of p -points of A. If T: A -> B is a surjective map onto a function algebra B subset of C(Y) such that either sigma(pi),(T f . Tg) subset of sigma(pi),(f g) for all f, g is an element of A, or, alternatively, sigma(pi),(f g) subset of sigma(pi),(T f . Tg) for all f, g is an element of A, then there is a homeomorphism psi: delta B -> delta A and a function a on delta B so that (T f)(y) = a(y) f (psi(y)) for all f is an element of A and y is an element of delta B. If, instead, sigma(pi),(T f . Tg) boolean AND sigma(pi),(f g) not equal phi for all f, g is an element of A, and either sigma(pi),(f) subset of sigma(pi),(T f) for all f is an element of A, or, alternatively, sigma(pi),(T f) subset of sigma(pi),(f) for all f is an element of A, then (T f)(y) = f (psi(y)) for all f is an element of A and y is an element of delta B. In particular, if A and B are uniform algebras and T : A -> B is a surjective map with sigma(pi), (T f . T g) boolean AND sigma(pi), (f g) not equal phi for all f, g is an element of A, that has a limit, say b, at some a e A with a(2) = 1, then (T f)(y) = b(y)alpha(psi (y)) f (is an element of(y)) for every f is an element of A and y is an element of delta B.