Sorry @Ted Lyngmo but I can't really comprehend this C code with my monkey brain. Is it fine if you could make this a little simple?
Thank You!