History Function

Added buttons and history management