Added require statements to control ordering and prevent unnecessary execution