Refactor Value class to be less awful.

Value is now parameterized by the type of value it holds. It also makes
the original type available, since for example an object reference value
is represented by a long.

Fixes #9