Implements back button functionality

Uses a transaction back stack to keep track of fragments that were
opened so users can navigate backwards when necessary.