fixed unpad to return None for errors
added more documentation