Moved some functionality from main file into achievements service