improve codes order