Made some tests and fixed some value storage bugs.