make the code faster.  also print out the result in a more easy to read manner