Reordered function declarations slightly