Rewrite with unittest lib