Cleaned up some code and added a method to do the switching. Something is still broken. :(