switchCollection Method, refoactor some code