Fixed spacing and simplified dict iterating

thanks to charettes for review