Put acceleration into a separate function.