Code simplifed