refactored achievement code and other stuff