Taking dependencies in account

Now it takes in account the dependency of each library so they're
concatenated in the correct order.