Move some code to value.h