  We provide an algorithm to solve the word problem in all fundamental groups
of closed 3-manifolds; in particular, we show that these groups are
autostackable. This provides a common framework for a solution to the word
problem in any closed 3-manifold group using finite state automata.
  We also introduce the notion of a group which is autostackable respecting a
subgroup, and show that a fundamental group of a graph of groups whose vertex
groups are autostackable respecting any edge group is autostackable. A group
that is strongly coset automatic over an autostackable subgroup, using a
prefix-closed transversal, is also shown to be autostackable respecting that
subgroup. Building on work by Antolin and Ciobanu, we show that a finitely
generated group that is hyperbolic relative to a collection of abelian
subgroups is also strongly coset automatic relative to each subgroup in the
collection. Finally, we show that fundamental groups of compact geometric
3-manifolds, with boundary consisting of (finitely many) incompressible torus
components, are autostackable respecting any choice of peripheral subgroup.
