Having only order would make this code simpler too.