Sort dependencies

Previous sorting in #155 was abandoned because of conflicts