Refactored slightly.
Refactored, accounting for the fact that order will always have a value.
Refactored, accounting for the fact that order will always have a value.
Refactoring for join queries.