Moved the logic for writing achievement progress into top-level code.