Made padding code simpler