diff --git a/Bootloaders/CDC/BootloaderCDC.c b/Bootloaders/CDC/BootloaderCDC.c
index d797915bc5..d72d128a12 100644
--- a/Bootloaders/CDC/BootloaderCDC.c
+++ b/Bootloaders/CDC/BootloaderCDC.c
@@ -66,6 +66,26 @@ bool RunBootloader = true;
  *  the loaded application code.
  */
 int main(void)
+{
+	/* Setup hardware required for the bootloader */
+	SetupHardware();
+
+	while (RunBootloader)
+	{
+		CDC_Task();
+		USB_USBTask();
+	}
+	
+	/* Reset all configured hardware to their default states for the user app */
+	ResetHardware();
+
+	/* Start the user application */
+	AppPtr_t AppStartPtr = (AppPtr_t)0x0000;
+	AppStartPtr();	
+}
+
+/** Configures all hardware required for the bootloader. */
+void SetupHardware(void)
 {
 	/* Disable watchdog if enabled by bootloader/fuses */
 	MCUSR &= ~(1 << WDRF);
@@ -80,18 +100,11 @@ int main(void)
 	
 	/* Initialize USB Subsystem */
 	USB_Init();
+}
 
-	while (RunBootloader)
-	{
-		USB_USBTask();
-		CDC_Task();
-	}
-	
-	Endpoint_SelectEndpoint(CDC_TX_EPNUM);
-
-	/* Wait until any pending transmissions have completed before shutting down */
-	while (!(Endpoint_IsINReady()));
-	
+/** Resets all configured hardware required for the bootloader back to their original states. */
+void ResetHardware(void)
+{
 	/* Shut down the USB subsystem */
 	USB_ShutDown();
 	
@@ -99,21 +112,8 @@ int main(void)
 	MCUCR = (1 << IVCE);
 	MCUCR = 0;
 
-	/* Reset any used hardware ports back to their defaults */
-	PORTD = 0;
-	DDRD  = 0;
-	
-	#if defined(PORTE)
-	PORTE = 0;
-	DDRE  = 0;
-	#endif
-	
 	/* Re-enable RWW section */
 	boot_rww_enable();
-
-	/* Start the user application */
-	AppPtr_t AppStartPtr = (AppPtr_t)0x0000;
-	AppStartPtr();	
 }
 
 /** Event handler for the USB_Disconnect event. This indicates that the bootloader should exit and the user
@@ -364,7 +364,7 @@ static void WriteNextResponseByte(const uint8_t Response)
 /** Task to read in AVR910 commands from the CDC data OUT endpoint, process them, perform the required actions
  *  and send the appropriate response back to the host.
  */
-TASK(CDC_Task)
+void CDC_Task(void)
 {
 	/* Select the OUT endpoint */
 	Endpoint_SelectEndpoint(CDC_RX_EPNUM);
@@ -566,6 +566,9 @@ TASK(CDC_Task)
 			while (!(Endpoint_IsINReady()));
 			Endpoint_ClearIN();
 		}
+
+		/* Wait until the data has been sent to the host */
+		while (!(Endpoint_IsINReady()));
 		
 		/* Select the OUT endpoint */
 		Endpoint_SelectEndpoint(CDC_RX_EPNUM);
diff --git a/Bootloaders/CDC/BootloaderCDC.h b/Bootloaders/CDC/BootloaderCDC.h
index da755936d5..97e32e9fb0 100644
--- a/Bootloaders/CDC/BootloaderCDC.h
+++ b/Bootloaders/CDC/BootloaderCDC.h
@@ -118,10 +118,11 @@
 			Parity_Space        = 4, /**< Space data parity checking */
 		};
 		
-	/* Tasks: */
-		TASK(CDC_Task);
-
 	/* Function Prototypes: */
+		void CDC_Task(void);
+		void SetupHardware(void);
+		void ResetHardware(void);
+
 		void EVENT_USB_Disconnect(void);
 		void EVENT_USB_ConfigurationChanged(void);
 		void EVENT_USB_UnhandledControlPacket(void);
diff --git a/Bootloaders/DFU/BootloaderDFU.c b/Bootloaders/DFU/BootloaderDFU.c
index 6da741e394..58a7511883 100644
--- a/Bootloaders/DFU/BootloaderDFU.c
+++ b/Bootloaders/DFU/BootloaderDFU.c
@@ -97,6 +97,23 @@ uint16_t EndAddr = 0x0000;
  *  the loaded application code.
  */
 int main (void)
+{
+	/* Configure hardware required by the bootloader */
+	SetupHardware();
+
+	/* Run the USB management task while the bootloader is supposed to be running */
+	while (RunBootloader || WaitForExit)
+	  USB_USBTask();
+	
+	/* Reset configured hardware back to their original states for the user application */
+	ResetHardware();
+	
+	/* Start the user application */
+	AppStartPtr();
+}
+
+/** Configures all hardware required for the bootloader. */
+void SetupHardware(void)
 {
 	/* Disable watchdog if enabled by bootloader/fuses */
 	MCUSR &= ~(1 << WDRF);
@@ -111,29 +128,17 @@ int main (void)
 
 	/* Initialize the USB subsystem */
 	USB_Init();
+}
 
-	/* Run the USB management task while the bootloader is supposed to be running */
-	while (RunBootloader || WaitForExit)
-	  USB_USBTask();
-	
+/** Resets all configured hardware required for the bootloader back to their original states. */
+void ResetHardware(void)
+{
 	/* Shut down the USB subsystem */
 	USB_ShutDown();
 	
 	/* Relocate the interrupt vector table back to the application section */
 	MCUCR = (1 << IVCE);
 	MCUCR = 0;
-
-	/* Reset any used hardware ports back to their defaults */
-	PORTD = 0;
-	DDRD  = 0;
-	
-	#if defined(PORTE)
-	PORTE = 0;
-	DDRE  = 0;
-	#endif
-	
-	/* Start the user application */
-	AppStartPtr();
 }
 
 /** Event handler for the USB_Disconnect event. This indicates that the bootloader should exit and the user
diff --git a/Bootloaders/DFU/BootloaderDFU.h b/Bootloaders/DFU/BootloaderDFU.h
index a78d80d0ca..776281eb8a 100644
--- a/Bootloaders/DFU/BootloaderDFU.h
+++ b/Bootloaders/DFU/BootloaderDFU.h
@@ -193,6 +193,9 @@
 		};
 				
 	/* Function Prototypes: */
+		void SetupHardware(void);
+		void ResetHardware(void);
+
 		void EVENT_USB_Disconnect(void);
 		void EVENT_USB_UnhandledControlPacket(void);
 
diff --git a/Bootloaders/TeensyHID/TeensyHID.c b/Bootloaders/TeensyHID/TeensyHID.c
index ee6c91a625..12d5c0de84 100644
--- a/Bootloaders/TeensyHID/TeensyHID.c
+++ b/Bootloaders/TeensyHID/TeensyHID.c
@@ -48,6 +48,27 @@ bool RunBootloader = true;
  *  runs the bootloader processing routine until instructed to soft-exit.
  */
 int main(void)
+{
+	/* Setup hardware required for the bootloader */
+	SetupHardware();
+	
+	while (RunBootloader)
+	  USB_USBTask();
+	
+	/* Reset all configured hardware to their default states for the user app */
+	ResetHardware();
+
+	/* Wait 100ms to give the host time to register the disconnection */
+	_delay_ms(100);
+
+	/* Enable the watchdog and force a timeout to reset the AVR */
+	wdt_enable(WDTO_250MS);
+					
+	for (;;);
+}
+
+/** Configures all hardware required for the bootloader. */
+void SetupHardware(void)
 {
 	/* Disable watchdog if enabled by bootloader/fuses */
 	MCUSR &= ~(1 << WDRF);
@@ -62,20 +83,13 @@ int main(void)
 
 	/* Initialize USB subsystem */
 	USB_Init();
-	
-	while (RunBootloader)
-	  USB_USBTask();
-	  
-	/* Shut down the USB interface, so that the host will register the disconnection */
+}
+
+/** Resets all configured hardware required for the bootloader back to their original states. */
+void ResetHardware(void)
+{
+	/* Shut down the USB subsystem */
 	USB_ShutDown();
-
-	/* Wait 100ms to give the host time to register the disconnection */
-	_delay_ms(100);
-
-	/* Enable the watchdog and force a timeout to reset the AVR */
-	wdt_enable(WDTO_250MS);
-					
-	for (;;);
 }
 
 /** Event handler for the USB_ConfigurationChanged event. This configures the device's endpoints ready
diff --git a/Bootloaders/TeensyHID/TeensyHID.h b/Bootloaders/TeensyHID/TeensyHID.h
index 0dd58524b7..9414eec774 100644
--- a/Bootloaders/TeensyHID/TeensyHID.h
+++ b/Bootloaders/TeensyHID/TeensyHID.h
@@ -59,9 +59,13 @@
 		/** HID Class specific request to send the next HID report to the device. */
 		#define REQ_SetReport             0x09
 		
+		/** Teensy Bootloader special address to start the user application */
 		#define TEENSY_STARTAPPLICATION   0xFFFF
 		
 	/* Function Prototypes: */
+		void SetupHardware(void);
+		void ResetHardware(void);
+
 		void EVENT_USB_ConfigurationChanged(void);
 		void EVENT_USB_UnhandledControlPacket(void);