adding output and final version of code