edit main logic