Achievements fix and refactoring