`decide_bufferaction` is not a descriptive name and it takes way too many parameters. Inline the code back. Using a `switch` was already an improvement.