Moved switch control to a new function, sendCommandParameters