Cleaning up code: reordered code.