debugging and alternative next implementation