Added depad function