improved output
added storing of result