Changed some references to values so that it'd work better in multithreaded contexts.