added i16 type also big refactor

in particular fixed a whole bunch of literal numeric type checks in
the code.