I had to spend many hours on this weirdo afplfllglglglgllf