padding fix + documentation

this code is coming from a really old project of mine