Better history handling and approximate completion