Some refactor and ava xp gain init.