Adjust some macros, add sort direction macro