added pad function: close #6