refactored the pins controller again