Refactor and added defensive coding

Added default case, and under it assert false as the inputparser will
always parse a action object.