action is now doing well, looping needs to be done. minor issues with debug function solved