Main reworked