first stab at logic