Back, forward ui buttons logic