Added adaptive version. Testing it.