Extracted reusable functions