Overhaul centering logic.

[Resolves #142]