Implemented some SWI support and some preliminary code for mode switching. Mode switching needs work.