adding a version that works as long as the stack is only 4k