Simplify the code a lot - don't try to be too clever and handle chips with