simplifying arduino sketch