Tidied up Arduino code