some arduino code improvements