Refactored calculation of request buffer size