add out method and complete example