method to remove padding