Improved function that addes elements to a stack. I guess, i have added sorting to the function
United YUV in threads