Changed actions from if/else if to use a switch