refactored Pins controller