fix spacing issue and use each instead of map