Moved pin settings to the main function.