added sort to ensure correct side/order