clean up gpio code State