making code more stdc like as arduino is too slow