M117 improvements

Added type encoding and checking for some parameter types.