Reworked phi to return AtEnd booleans