Naive implementation ignoring the stack for now