New logic of code implemented