Refactored gpio