improve session API