code simplificated