fixed a bug regarding the component orders

merged upload new and existing files into one function to fix the order
issue