The code just need to be moved. See attachment in post #17