Refator to use values and clean up miscellaneous code