some changes in solving logic