Added a map over all pieces for a color, refactored a bit