added XP algorithm