You seemed to be closer at this pic:



Can you post that version of code? So, that a comparison of both might give an idea how to proceed?