initializing units and gates