added logic for no history