cherrypicked from template
solve conflict for cherry-pick
modify padding