added a condition for padding