better version of buffer switch