updated padding functionality