Functions f from Fn p, n = 2m, to Z pk for which the character sum Hk f (pt, u) = similar to x.Fn p. ptf (x) pk. u. x p (where.q = e2pi/ q is a q-th root of unity), has absolute value pm for all u. Fn p and 0 = t = k - 1, induce relative difference sets in Fn p x Z pk hence are called bent. Functions only necessarily satisfying |Hk f (1, u)| = pm are called generalized bent. We show that with spreads we not only can construct a variety of bent and generalized bent functions, but also can design functions from Fn p to Zpm satisfying |Hm f (pt, u)| = pm if and only if t. T for any T. {0, 1..., m- 1}. A generalized bent function can also be seen as a Boolean (p-ary) bent function together with a partition of Fn p with certain properties. We show that the functions from the completed Maiorana-McFarland class are bent functions, which allow the largest possible partitions.