working on adaptation algo