Reorder code block by dependency use (easier to review)