Added a generalized version of the numeric class hirarchy

See commits.