structure rebuilt and new logic added