simplify rentrant api
cleanup rentrant code more, compile with -O2