modified to work with race as well