cleaned up arduino code