-- refactored gpio part