First naive implementation with no exit conditions