added suggestion for simplifying code