Fixed some minor bugs and reworked IO swapping