Fixed to the over all state machine and debugged a few wonky bits here and there, so it all seems to work correctly now