working with output
final version