Added function to strip padding