Fix back/forwards behaviour and titles.

Rebased and fixed #147.