Simply use array key for step sort order, instead of arbitrary counter
Cast step sort order as integer when sorting results