Refactoring Value.java and some more tests