Reworked the padding again. Slightly simpler and much less flawed. Last update always added the buffer twice. Oops.