sort layers based on how they are in the markup