Refactor Arduino code to have classes