Modifying all the logic idea for new implementation