I'm nowhere close being able to give you the solution, but do think that the core issue here is copying code and expecting it to work without you, the programmer, understanding how it operates.

My...