Complexity controlled by hierarchical ordering of function and variability