solved bad horse
added some comments
print the solution rather than create a temp